package com.cz.fra.android;

import java.io.IOException;
import java.util.Properties;

public class Config {
	private static Config instance;
	
	private Config(){}
	
	public static Config getInstance(){
		if(instance == null){
			return new Config();
		}
		return instance;
	}
	
	public static final int REGISTER_SUCCESS = 0;
	public static final int CAUGHTS = 2;
	public static final int BAITS = 3;
	public static final int LOCATIONS = 1;
	public static String SERVER_URL;
	public static String SERVER_IP;
	public static String SERVER_PORT;
	public static String FTP_ACCOUNT;
	public static String FTP_AUTH;
	public static String FTP_REMOTE_PATH;
	
	public static String URL_REFRESH;
	public static String URL_COMMENT_LIST;
	public static String URL_USER_LIST;
    public static String URL_LOGIN;
    public static String URL_REGISTER;
    public static String URL_UPLOAD;
    public static String URL_POST;
    public static String URL_COMMENT;
    public static String URL_LOCATIONS;
    public static String URL_BAITS;
    public static String URL_SPECIES;
    public static String URL_REPORT_LIST;
    
    public void readConfig(){
    	Properties pro = new Properties();
    	try {
			pro.load(Config.class.getResourceAsStream("/assets/config.properties"));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    	SERVER_URL = pro.getProperty("server.url");
    	SERVER_IP = pro.getProperty("server.ip");
//    	SERVER_PORT = pro.getProperty("server.port");
    	FTP_ACCOUNT = pro.getProperty("server.ftp.account");
    	FTP_AUTH = pro.getProperty("server.ftp.auth");
    	FTP_REMOTE_PATH = pro.getProperty("server.ftp.path");
    	
//    	URL_REFRESH =  SERVER_URL + "/servlet/refresh";
//		URL_COMMENT_LIST = SERVER_URL + "/servlet/getCommentList";
//		URL_USER_LIST = SERVER_URL + "/servlet/getUserList";
//	    URL_LOGIN = SERVER_URL + "/servlet/login";
//	    URL_REGISTER = SERVER_URL + "/servlet/register";
//	    URL_UPLOAD= SERVER_URL + "/servlet/photoupload";
//	    URL_POST = SERVER_URL + "/servlet/postReport";
//	    URL_COMMENT = SERVER_URL + "/servlet/postComment";
//	    URL_LOCATIONS = SERVER_URL + "/servlet/getLocations";
//	    URL_BAITS = SERVER_URL + "/servlet/getBaits";
//	    URL_SPECIES = SERVER_URL + "/servlet/getSpecies";
//	    URL_REPORT_LIST = SERVER_URL + "/servlet/getReportList";
	    
    	//For test
	    URL_REFRESH =  SERVER_URL + "/refresh";
		URL_COMMENT_LIST = SERVER_URL + "/getCommentList";
		URL_USER_LIST = SERVER_URL + "/getUserList";
	    URL_LOGIN = SERVER_URL + "/login";
	    URL_REGISTER = SERVER_URL + "/register";
	    URL_UPLOAD= SERVER_URL + "/photoupload";
	    URL_POST = SERVER_URL + "/postReport";
	    URL_COMMENT = SERVER_URL + "/postComment";
	    URL_LOCATIONS = SERVER_URL + "/getLocations";
	    URL_BAITS = SERVER_URL + "/getBaits";
	    URL_SPECIES = SERVER_URL + "/getSpecies";
	    URL_REPORT_LIST = SERVER_URL + "/getReportList";
    }
}
